<?php

include '../function.php'; 

$dsn = "mysql:host=localhost;dbname=school";
$username="root";
$password = "";

try{

	$pdo = new Pdo($dsn,$username,$password);

}catch(PDOException $e) {

	die($e->getMessage());

}


$pdo->query("set names utf8");

$sql = "select * from  stu";

// // // $sql = "select stu.name,class.classname from stu left join class on stu.cid=class.id";

$result = $pdo->query($sql);

// $arr  = $result->fetchAll(PDO::FETCH_ASSOC);


// $sql = "insert into stu (name,qq) value('马志斌','23423423')";

// $sql = "delete from stu where id > 30";


// $result = $pdo->exec($sql);

// var_dump($result);





$sql = "insert into stu(name) values(?)";

$state = $pdo->prepare($sql);

var_dump($state);

$sname = "baidu";

$state->bindParam(1,$sname,PDO::PARAM_STR);

var_dump($state->execute());



















 ?>